/*
 * Created by JFormDesigner on Wed Jun 26 14:38:24 CST 2024
 */

package scct.chenlixian.ui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

/**
 * @author DELL
 */
public class FormMain extends JFrame {
    public FormMain() {
        initComponents();
    }

    private void butUser(ActionEvent e) {
        //创建usermanage面板
        PanelUserManager panelUserManager = new PanelUserManager(this);
        panel1.removeAll();
//        加载用户管理面板
        panel1.add(panelUserManager, BorderLayout.CENTER);
//        刷新页面
        validate();
    }

    private void btnType(ActionEvent e) {
        PanelType panelType = new PanelType(this);
        panel1.removeAll();
        panel1.add(panelType, BorderLayout.CENTER);
        validate();
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents  @formatter:off
        // Generated using JFormDesigner Evaluation license - CLX
        menuBar1 = new JMenuBar();
        menu1 = new JMenu();
        mnuUser = new JMenuItem();
        mnuExit = new JMenuItem();
        menu2 = new JMenu();
        mennBrand = new JMenuItem();
        menuType = new JMenuItem();
        mnuGoods = new JMenuItem();
        mnuSell = new JMenuItem();
        menu3 = new JMenu();
        mnuAbout = new JMenuItem();
        menuItem7 = new JMenuItem();
        toolBar1 = new JToolBar();
        butUser = new JButton();
        btnType = new JButton();
        btnBrand = new JButton();
        button4 = new JButton();
        button5 = new JButton();
        panel1 = new JPanel();

        //======== this ========
        setTitle("\u5546\u54c1\u7ba1\u7406\u7cfb\u7edf");
        Container contentPane = getContentPane();
        contentPane.setLayout(new BorderLayout());

        //======== menuBar1 ========
        {

            //======== menu1 ========
            {
                menu1.setText("\u7cfb\u7edf");

                //---- mnuUser ----
                mnuUser.setText("\u7528\u6237\u7ba1\u7406");
                menu1.add(mnuUser);

                //---- mnuExit ----
                mnuExit.setText("\u9000\u51fa");
                menu1.add(mnuExit);
            }
            menuBar1.add(menu1);

            //======== menu2 ========
            {
                menu2.setText("\u7ba1\u7406");

                //---- mennBrand ----
                mennBrand.setText("\u54c1\u724c\u7ba1\u7406");
                menu2.add(mennBrand);

                //---- menuType ----
                menuType.setText("\u7c7b\u522b\u7ba1\u7406");
                menu2.add(menuType);

                //---- mnuGoods ----
                mnuGoods.setText("\u5546\u54c1\u7ba1\u7406");
                menu2.add(mnuGoods);

                //---- mnuSell ----
                mnuSell.setText("\u9500\u552e\u7ba1\u7406");
                menu2.add(mnuSell);
            }
            menuBar1.add(menu2);

            //======== menu3 ========
            {
                menu3.setText("\u5173\u4e8e");

                //---- mnuAbout ----
                mnuAbout.setText("\u6211\u7684\u9879\u76ee");
                menu3.add(mnuAbout);
            }
            menuBar1.add(menu3);
            menuBar1.add(menuItem7);
        }
        setJMenuBar(menuBar1);

        //======== toolBar1 ========
        {
            toolBar1.setFloatable(false);

            //---- butUser ----
            butUser.setIcon(new ImageIcon(getClass().getResource("/icon/tubiao.png")));
            butUser.addActionListener(e -> butUser(e));
            toolBar1.add(butUser);

            //---- btnType ----
            btnType.setIcon(new ImageIcon(getClass().getResource("/icon/sb.png")));
            btnType.addActionListener(e -> btnType(e));
            toolBar1.add(btnType);

            //---- btnBrand ----
            btnBrand.setIcon(new ImageIcon(getClass().getResource("/icon/l.png")));
            toolBar1.add(btnBrand);

            //---- button4 ----
            button4.setIcon(new ImageIcon(getClass().getResource("/icon/tubiao.png")));
            toolBar1.add(button4);

            //---- button5 ----
            button5.setIcon(new ImageIcon(getClass().getResource("/icon/xs.png")));
            toolBar1.add(button5);
        }
        contentPane.add(toolBar1, BorderLayout.NORTH);

        //======== panel1 ========
        {
            panel1.setBorder(new javax.swing.border.CompoundBorder(new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(
                    0, 0, 0, 0), "JFor\u006dDesi\u0067ner \u0045valu\u0061tion", javax.swing.border.TitledBorder.CENTER, javax.swing.border.TitledBorder
                    .BOTTOM, new java.awt.Font("Dia\u006cog", java.awt.Font.BOLD, 12), java.awt.Color.
                    red), panel1.getBorder()));
            panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
                @Override
                public void propertyChange(java.
                                                   beans.PropertyChangeEvent e) {
                    if ("bord\u0065r".equals(e.getPropertyName())) throw new RuntimeException();
                }
            });
            panel1.setLayout(new BorderLayout());
        }
        contentPane.add(panel1, BorderLayout.CENTER);
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents  @formatter:on
    }

    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables  @formatter:off
    // Generated using JFormDesigner Evaluation license - CLX
    private JMenuBar menuBar1;
    private JMenu menu1;
    private JMenuItem mnuUser;
    private JMenuItem mnuExit;
    private JMenu menu2;
    private JMenuItem mennBrand;
    private JMenuItem menuType;
    private JMenuItem mnuGoods;
    private JMenuItem mnuSell;
    private JMenu menu3;
    private JMenuItem mnuAbout;
    private JMenuItem menuItem7;
    private JToolBar toolBar1;
    private JButton butUser;
    private JButton btnType;
    private JButton btnBrand;
    private JButton button4;
    private JButton button5;
    private JPanel panel1;
    // JFormDesigner - End of variables declaration  //GEN-END:variables  @formatter:on
}
